/** * @license * Copyright 2017 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core"; import { ApiDefinition } from "../../../../models/api.model"; import { CombinedVisitorAdapter, ICommand, IDefinition, IReferenceResolver, IValidationSeverityRegistry, Node, Oas20ResponseDefinition, Oas20SchemaDefinition, Oas30ResponseDefinition, Oas30SchemaDefinition, OasDocument, OasPathItem, OtCommand, OtEngine, ValidationProblem } from "apicurio-data-models"; import { EditorMasterComponent } from "./_components/master.component"; import { VersionedAck } from "../../../../models/ack.model"; import { ApiEditorUser } from "../../../../models/editor-user.model"; import { SelectionService } from "./_services/selection.service"; import { CommandService } from "./_services/command.service"; import { DocumentService } from "./_services/document.service"; import { ServerEditorComponent } from "./_components/editors/server-editor.component"; import { EditorsService, IEditorsProvider } from "./_services/editors.service"; import { SecuritySchemeEditorComponent } from "./_components/editors/security-scheme-editor.component"; import { SecurityRequirementEditorComponent } from "./_components/editors/security-requirement-editor.component"; import { DataTypeEditorComponent } from "./_components/editors/data-type-editor.component"; import { ParameterEditorComponent } from "./_components/editors/parameter-editor.component"; import { PropertyEditorComponent } from "./_components/editors/property-editor.component"; import { ApiEditorComponentFeatures } from "./_models/features.model"; import { FeaturesService } from "./_services/features.service"; import { CollaboratorService } from "./_services/collaborator.service"; import { ResponseEditorComponent } from "./_components/editors/response-editor.component"; import { AbstractApiEditorComponent } from "./editor.base"; import { ApiCatalogService } from "./_services/api-catalog.service"; import { ComponentType } from "./_models/component-type.model"; import { ImportedComponent } from "./_models/imported-component.model"; import { OperationTraitEditorComponent } from "./_components/editors/operationtrait-editor.component"; import { MessageTraitEditorComponent } from "./_components/editors/messagetrait-editor.component"; import { MessageEditorComponent } from "./_components/editors/message-editor.component"; import { AaiServerEditorComponent } from "./_components/editors/aaiserver-editor.component"; import { OneOfInMessageEditorComponent } from "./_components/editors/oneof-in-message-editor.component"; export declare class ApiEditorComponent extends AbstractApiEditorComponent implements OnChanges, OnInit, OnDestroy, IEditorsProvider, IReferenceResolver { private selectionService; private commandService; private documentService; private editorsService; private featuresService; private collaboratorService; private catalog; api: ApiDefinition; embedded: boolean; features: ApiEditorComponentFeatures; validationRegistry: IValidationSeverityRegistry; contentFetcher: (externalReference: string) => Promise; componentImporter: (componentType: ComponentType) => Promise; onCommandExecuted: EventEmitter; onSelectionChanged: EventEmitter; onValidationChanged: EventEmitter; onUndo: EventEmitter; onRedo: EventEmitter; onConfigureValidation: EventEmitter; private _document; private _otEngine; _undoableCommandCount: number; _redoableCommandCount: number; theme: string; private currentSelection; private currentSelectionType; private currentSelectionNode; validationErrors: ValidationProblem[]; private _selectionSubscription; private _commandSubscription; private _catalogSubscription; master: EditorMasterComponent; serverEditor: ServerEditorComponent; securitySchemeEditor: SecuritySchemeEditorComponent; securityRequirementEditor: SecurityRequirementEditorComponent; dataTypeEditor: DataTypeEditorComponent; responseEditor: ResponseEditorComponent; parameterEditor: ParameterEditorComponent; propertyEditor: PropertyEditorComponent; formType: string; /** * Constructor. * @param selectionService * @param commandService * @param documentService * @param editorsService * @param featuresService * @param collaboratorService * @param catalog */ constructor(selectionService: SelectionService, commandService: CommandService, documentService: DocumentService, editorsService: EditorsService, featuresService: FeaturesService, collaboratorService: CollaboratorService, catalog: ApiCatalogService); /** * Called when the editor is initialized by angular. */ ngOnInit(): void; /** * Called when angular destroys the editor component. */ ngOnDestroy(): void; /** * Called when the @Input changes. * @param changes */ ngOnChanges(changes: SimpleChanges): void; /** * Gets the OpenAPI spec as a document. */ document(): OasDocument; /** * Lazy getter for the OtEngine. */ otEngine(): OtEngine; /** * Called whenever the user presses a key. * @param event */ onGlobalKeyDown(event: KeyboardEvent): void; private static isUndo; private static isRedo; /** * Called when the user clicks the Undo button or uses the Ctrl-z hotkey. */ undoLastCommand(): void; /** * Called when the user clicks the Redo button or uses the Ctrl-y hotkey. */ redoLastCommand(): void; /** * Called when an editor component creates a command that should be executed. * @param command */ protected onCommand(command: ICommand): void; /** * Executes a command. Called by the parent of this component when detecting that * another user has executed a command. In other words, this command is *not* * performed by the local user. * @param command */ executeCommand(command: OtCommand): void; /** * Call this to undo a command. Typically this is used to undo commands from * remote collaborators after receiving an async message from the server. * @param command */ undoCommand(command: OtCommand | number | string): void; /** * Call this to redo a command. Typically this is used to undo commands from * remote collaborators after receiving an async message from the server. * @param command */ redoCommand(command: OtCommand | number): void; /** * Finalizes a command. * @param ack */ finalizeCommand(ack: VersionedAck): void; /** * Called to update the selection state of the given remote API editor (i.e. an active collaborator). * @param user * @param selection */ updateCollaboratorSelection(user: ApiEditorUser, selection: string): void; /** * Called when the user selects a node in some way. * @param path */ onNodeSelected(path: string): void; /** * Called to update which form is displayed (the details view). * @param path */ private updateFormDisplay; /** * Called to validate the model. */ validateModel(): void; /** * Returns the currently selected path item. * @return */ selectedPath(): OasPathItem; /** * Returns the currently selected definition. * @return */ selectedDefinition(): Oas20SchemaDefinition | Oas30SchemaDefinition; /** * Returns the currently selected response. */ selectedResponse(): Oas20ResponseDefinition | Oas30ResponseDefinition; deselectPath(): void; deselectDefinition(): void; deselectResponse(): void; preDocumentChange(): void; postDocumentChange(): void; /** * Called to get the current value in the editor. * @return */ getValue(): ApiDefinition; /** * Call this to select some content in the open document by the content's node path. If highlight * is true then the appropriate content section is also highlighted and scrolled into view. * @param path * @param highlight */ select(path: string, highlight?: boolean): void; /** * Resolves a $ref reference from a Document. Uses the API catalog to resolve the external * content and, if found, selects the appropriate * @param reference * @param from */ resolveRef(reference: string, from: Node): Node; getServerEditor(): ServerEditorComponent; getAaiServerEditor(): AaiServerEditorComponent; getSecuritySchemeEditor(): SecuritySchemeEditorComponent; getSecurityRequirementEditor(): SecurityRequirementEditorComponent; getDataTypeEditor(): DataTypeEditorComponent; getResponseEditor(): ResponseEditorComponent; getParameterEditor(): ParameterEditorComponent; getPropertyEditor(): PropertyEditorComponent; getOperationTraitEditor(): OperationTraitEditorComponent; getMessageTraitEditor(): MessageTraitEditorComponent; getMessageEditor(): MessageEditorComponent; getOneOfInMessageEditor(): OneOfInMessageEditorComponent; importComponent(type: ComponentType): void; } /** * Visitor used to determine what form should be displayed based on the selected node. */ export declare class FormSelectionVisitor extends CombinedVisitorAdapter { private version; _selectionType: string; _selectedNode: Node; constructor(version: string); selectionType(): string; formType(): string; selection(): Node; visitPathItem(node: OasPathItem): void; visitSchemaDefinition(node: Oas20SchemaDefinition | Oas30SchemaDefinition): void; visitResponseDefinition(node: IDefinition): void; }